<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备号">
              <a-input placeholder="请输入设备号" v-model="queryParam.deviceNo"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    
    <!-- 操作按钮区域 -->
    <div class="table-operator">

      <a-button type="primary" icon="download" @click="handleExportXls('pudong_device_data')">导出</a-button>

    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="action" slot-scope="text, record">

             <a-menu-item>
                <a @click="handleAllDetail(record)">详情</a>
              </a-menu-item>

        </span>

      </a-table>
    </div>

    <pudong-device-data-modal ref="modalForm" @ok="modalFormOk"/>
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import PudongDeviceDataModal from './modules/PudongDeviceDataModal'
  import '@/assets/less/TableExpand.less'


  export default {
    name: "PudongDeviceDataList",
    mixins:[JeecgListMixin],
    components: {
      PudongDeviceDataModal
    },
    data () {
      return {
        description: '站点数据管理页面',
        // 表头
        columns: [
          {
            title:'创建时间',
            align:"center",
            dataIndex: 'createTime'
          },

          {
            title:'上报时间',
            align:"center",
            dataIndex: 'timestamp'
          },
          {
            title:'设备ID号',
            align:"center",
            dataIndex: 'deviceNo'
          },
          {
            title:'采集时间',
            align:"center",
            dataIndex: 'tt'
          },
          {
            title:'分钟内极大风速（瞬时风速）对应风向',
            align:"center",
            dataIndex: 'aef'
          },
          {
            title:'1分钟内极大风速',
            align:"center",
            dataIndex: 'afaa'
          },
          {
            title:'二分钟平均风向',
            align:"center",
            dataIndex: 'aec'
          },
          {
            title:'二分钟平均风速',
            align:"center",
            dataIndex: 'afc'
          },
          {
            title:'十分钟平均风向',
            align:"center",
            dataIndex: 'aed'
          },
          {
            title:'十分钟平均风速',
            align:"center",
            dataIndex: 'afd'
          },
          {
            title:'某时间段内的(如小时、天等）最大风速（十分钟平均分速）对应风向',
            align:"center",
            dataIndex: 'aeg'
          },
          {
            title:'某时间段内的最大风速',
            align:"center",
            dataIndex: 'afda'
          },
          {
            title:'某时间段 (如小时、天等）内的最大风速（10分钟平均风速）时间',
            align:"center",
            dataIndex: 'afdb'
          },
          {
            title:'某时间段内的(如小时、天等）极大风速（瞬时风速）对应风向',
            align:"center",
            dataIndex: 'aee'
          },
          {
            title:'某时间段内的极大风速',
            align:"center",
            dataIndex: 'afae'
          },
          {
            title:'某时间段(如小时、天等）内的极大风速时间',
            align:"center",
            dataIndex: 'afaf'
          },
          {
            title:'1.5米高度的空气温度',
            align:"center",
            dataIndex: 'aaa'
          },
          {
            title:'最高温度',
            align:"center",
            dataIndex: 'aaaa'
          },
          {
            title:'最高温度时间',
            align:"center",
            dataIndex: 'aaab'
          },
          {
            title:'最低温度',
            align:"center",
            dataIndex: 'aaac'
          },
          {
            title:'最低温度时间',
            align:"center",
            dataIndex: 'aaad'
          },
          {
            title:'1.5米高度的相对湿度',
            align:"center",
            dataIndex: 'ada'
          },
          {
            title:'1.5米高度的相对最低湿度',
            align:"center",
            dataIndex: 'adac'
          },
          {
            title:'1.5米高度的最低相对湿度时间',
            align:"center",
            dataIndex: 'adad'
          },
          {
            title:'本站气压',
            align:"center",
            dataIndex: 'aga'
          },
          {
            title:'最高气压',
            align:"center",
            dataIndex: 'agaa'
          },
          {
            title:'最高气压时间',
            align:"center",
            dataIndex: 'agab'
          },
          {
            title:'最低气压',
            align:"center",
            dataIndex: 'agac'
          },
          {
            title:'最低气压时间',
            align:"center",
            dataIndex: 'agad'
          },
          {
            title:'分钟降水(翻斗等)',
            align:"center",
            dataIndex: 'aha1'
          },
          {
            title:'小时累计降水（翻斗等）',
            align:"center",
            dataIndex: 'ahb1'
          },
          {
            title:'小时内分钟降水（软件统计，翻斗）',
            align:"center",
            dataIndex: 'ahl1'
          },
          {
            title:'露点温度温度',
            align:"center",
            dataIndex: 'adb'
          },
          {
            title:'水气压',
            align:"center",
            dataIndex: 'adc'
          },
          {
            title:'质量控制',
            align:"center",
            dataIndex: 'qc'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/com.pudong/pudongDeviceData/list",
          delete: "/com.pudong/pudongDeviceData/delete",
          deleteBatch: "/com.pudong/pudongDeviceData/deleteBatch",
          exportXlsUrl: "/com.pudong/pudongDeviceData/exportXls",
          importExcelUrl: "com.pudong/pudongDeviceData/importExcel",
          
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      handleAllDetail: function (record) {
        this.$refs.modalForm.handleAllDetail(record);
        this.$refs.modalForm.title = "详情";
        this.$refs.modalForm.disableSubmit = true;
      },

      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
         fieldList.push({type:'string',value:'timestamp',text:'时间戳',dictCode:''})
         fieldList.push({type:'string',value:'deviceNo',text:'设备ID号',dictCode:''})
         fieldList.push({type:'string',value:'tt',text:'观测时间',dictCode:''})
         fieldList.push({type:'int',value:'aef',text:'分钟内极大风速（瞬时风速）对应风向',dictCode:''})
         fieldList.push({type:'double',value:'afaa',text:'1分钟内极大风速',dictCode:''})
         fieldList.push({type:'int',value:'aec',text:'二分钟平均风向',dictCode:''})
         fieldList.push({type:'double',value:'afc',text:'二分钟平均风速',dictCode:''})
         fieldList.push({type:'int',value:'aed',text:'十分钟平均风向',dictCode:''})
         fieldList.push({type:'double',value:'afd',text:'十分钟平均风速',dictCode:''})
         fieldList.push({type:'int',value:'aeg',text:'某时间段内的(如小时、天等）最大风速（十分钟平均分速）对应风向',dictCode:''})
         fieldList.push({type:'double',value:'afda',text:'某时间段内的最大风速',dictCode:''})
         fieldList.push({type:'string',value:'afdb',text:'某时间段 (如小时、天等）内的最大风速（10分钟平均风速）时间',dictCode:''})
         fieldList.push({type:'string',value:'afdbDict',text:'某 时间段 (如小时、天等）内的最大风速（10分钟平均风速）时间解析',dictCode:''})
         fieldList.push({type:'int',value:'aee',text:'某时间段内的(如小时、天等）极大风速（瞬时风速）对应风向',dictCode:''})
         fieldList.push({type:'double',value:'afae',text:'某时间段内的极大风速',dictCode:''})
         fieldList.push({type:'string',value:'afaf',text:'某时间段(如小时、天等）内的极大风速时间',dictCode:''})
         fieldList.push({type:'double',value:'aaa',text:'1.5米高度的空气温度',dictCode:''})
         fieldList.push({type:'double',value:'aaaa',text:'最高温度',dictCode:''})
         fieldList.push({type:'string',value:'aaab',text:'最高温度时间',dictCode:''})
         fieldList.push({type:'double',value:'aaac',text:'最低温度',dictCode:''})
         fieldList.push({type:'string',value:'aaad',text:'最低温度时间',dictCode:''})
         fieldList.push({type:'double',value:'ada',text:'1.5米高度的相对湿度',dictCode:''})
         fieldList.push({type:'double',value:'adac',text:'1.5米高度的相对最低湿度',dictCode:''})
         fieldList.push({type:'string',value:'adad',text:'1.5米高度的最低相对湿度时间',dictCode:''})
         fieldList.push({type:'double',value:'aga',text:'本站气压',dictCode:''})
         fieldList.push({type:'double',value:'agaa',text:'最高气压',dictCode:''})
         fieldList.push({type:'string',value:'agab',text:'最高气压时间',dictCode:''})
         fieldList.push({type:'double',value:'agac',text:'最低气压',dictCode:''})
         fieldList.push({type:'string',value:'agad',text:'最低气压时间',dictCode:''})
         fieldList.push({type:'double',value:'aha1',text:'分钟降水(翻斗等)',dictCode:''})
         fieldList.push({type:'double',value:'ahb1',text:'小时累计降水（翻斗等）',dictCode:''})
         fieldList.push({type:'string',value:'ahl1',text:'小时内分钟降水（软件统计，翻斗）',dictCode:''})
         fieldList.push({type:'double',value:'adb',text:'露点温度温度',dictCode:''})
         fieldList.push({type:'double',value:'adc',text:'水气压',dictCode:''})
         fieldList.push({type:'string',value:'qc',text:'质量控制',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>